package com.cenwangkeji.zhihuimuye.ui.activity;


import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.cenwangkeji.zhihuimuye.R;
import com.cenwangkeji.zhihuimuye.model.bean.CowBean;
import com.cenwangkeji.zhihuimuye.ui.adapter.MainAdapter;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.lws.basic.base.BaseActivity;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
//牛只列表
public class CowStatisticsDetailActivity extends BaseActivity implements BaseQuickAdapter.OnItemChildClickListener
{


    @BindView(R.id.rv)
    RecyclerView mRv;
    private MainAdapter mAdapter;

    @Override
    public int setLayoutId() {
        return R.layout.activity_cow_statistics_detail;

    }

    @Override
    public void initData() {
        super.initData();
        ButterKnife.bind(this);

    }

    private void initRecycler(){
        List<CowBean> list = new ArrayList<>();
        CowBean cowBean = new CowBean();
        cowBean.setId("B00001");
        CowBean cowBean1 = new CowBean();
        cowBean1.setId("B00002");
        CowBean cowBean2 = new CowBean();
        cowBean2.setId("B00003");
        CowBean cowBean3 = new CowBean();
        cowBean3.setId("B00004");
        CowBean cowBean4 = new CowBean();
        cowBean4.setId("B00005");
        CowBean cowBean5 = new CowBean();
        cowBean5.setId("B00006");
        CowBean cowBean6 = new CowBean();
        cowBean6.setId("B00007");
        CowBean cowBean7 = new CowBean();
        cowBean7.setId("B00008");
        CowBean cowBean8 = new CowBean();
        cowBean8.setId("B00009");
        list.add(cowBean);
        list.add(cowBean1);
        list.add(cowBean2);
        list.add(cowBean3);
        list.add(cowBean4);
        list.add(cowBean5);
        list.add(cowBean6);
        list.add(cowBean7);
        list.add(cowBean8);
        mRv.setLayoutManager(new LinearLayoutManager(this));
        mAdapter = new MainAdapter(list);
        mAdapter.openLoadAnimation(BaseQuickAdapter.SCALEIN);
        mAdapter.setOnItemChildClickListener(this);
        mRv.setAdapter(mAdapter);
    }

    @OnClick(R.id.btn_scan)
    public void onViewClicked() {
        initRecycler();
    }


    @Override
    public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
        switch (view.getId()){
            case R.id.tv_detail:
            case R.id.tv_id:
                startActivity(new Intent(this,CowDetailActivity.class));
                break;
            case R.id.iv:
                startActivity(new Intent(this,VideoActivity.class));
                break;
        }
    }
}
